package ui;

import java.awt.Button;
import java.awt.Dimension;
import java.awt.Panel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class CantinaUI {
	
	private JFrame janela;
	private Panel painelPricipal;
	
	public void montarJanela(){
		janela = new JFrame("Cantina ADNIPO");
		janela.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	public void montarPainelPrincipal(){
		painelPricipal = new Panel();
		janela.add(painelPricipal);
	}
	public void montarBotaoSair(){
		Button btSair = new Button("Sair");
		btSair.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				System.exit(0);	
			}
		});
		painelPricipal.add(btSair);
	}
	public void montarBotaoAbrir(){
		Button btAbrir = new Button("Abrir");
		btAbrir.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				new JOptionPane().showMessageDialog(null, "botao apertado");
			}
		});
		painelPricipal.add(btAbrir);
	}
	public void mostraJanela(){
		janela.pack();
		Dimension minSize = new Dimension(800, 600); 
		janela.setExtendedState(JFrame.MAXIMIZED_BOTH);
		janela.setMinimumSize(minSize);
		//janela.setSize(800, 600);
		janela.setVisible(true);
	}

	public void montaTela(){
		montarJanela();
		montarPainelPrincipal();
		montarBotaoSair();
		montarBotaoAbrir();
		mostraJanela();
	}

	public static void main(String[] args) {
		new CantinaUI().montaTela();
	}

}
